﻿using UnityEngine;
using System.Collections;

public class StatusBar : MonoBehaviour {

  float progress = 0f, totalHappines;
  Vector2 pos = new Vector2(20, 40);
  Vector2 size = new Vector2(100,50);
  public Texture2D progressBarFull, progressBarEmpty;
  //Rect bar 
  SideMenu sideMenu;

	// Use this for initialization
	void Start () 
  {
    totalHappines = (float)sideMenu.score;
	}
	
	// Update is called once per frame
	void Update () 
  {
    totalHappines = (float)sideMenu.score;
    print(totalHappines);
    progress = totalHappines*.01f;
	}

  void OnGUI()
  {
    GUILayout.BeginVertical();
    GUI.DrawTexture(new Rect(pos.x, pos.y, size.x, size.y), progressBarEmpty);
    GUI.DrawTexture(new Rect(pos.x, pos.y, size.x * Mathf.Clamp01(progress), size.y), progressBarFull);
    GUILayout.EndVertical();
  }
}
